//
//  TapAuthorView.m
//  bh
//
//  Created by lanou on 15/12/24.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "TapAuthorView.h"

@implementation TapAuthorView

- (instancetype)initWithFrame:(CGRect)frame{
    self =[super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor orangeColor];
        
        //头像
        _authorView = [[UIImageView alloc]initWithFrame:(CGRectMake(kWidth/ 3 +30, 50, 60, 60))];
        _authorView.layer.masksToBounds = YES;
        _authorView.layer.borderWidth = 2;
        _authorView.layer.cornerRadius = _authorView.bounds.size.width / 2;
        _authorView.layer.borderColor = [UIColor clearColor].CGColor;
        [self addSubview:_authorView];
        
        _authorNickLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0, 110, kWidth, 30))];
        _authorNickLabel.textColor = [UIColor whiteColor];
        _authorNickLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_authorNickLabel];
        
        _locationLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0, 140, kWidth, 40))];
        _locationLabel.textAlignment = NSTextAlignmentCenter;
        _locationLabel.font = [UIFont systemFontOfSize:22];
        _locationLabel.textColor = [UIColor whiteColor];
        [self addSubview:_locationLabel];

    
        _backButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        _backButton.frame = CGRectMake(10, 10, 40, 40);
        [_backButton setImage:[[UIImage imageNamed:@"arrowdown.png"] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)] forState:(UIControlStateNormal)];
        [self addSubview:_backButton];
        
        _addButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        _addButton.frame = CGRectMake(kWidth /5, 170, 100, 60);
        [_addButton setImage:[[UIImage imageNamed:@"设计师-加关注v2@2x.png"] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)] forState:(UIControlStateNormal)];
        [self addSubview:_addButton];
        
        _sixinButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        _sixinButton.frame = CGRectMake(kWidth / 2, 170, 100, 60);
        [_sixinButton setImage:[[UIImage imageNamed:@"设计师-私信v2@2x.png"] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)] forState:(UIControlStateNormal)];
        [self addSubview:_sixinButton];
        
    }
    return self;
}

- (void)setPhotos:(Photos *)photos{
    
    if (_photos != photos) {
        _photos = photos;
        
        [_authorView setImageWithURL:[NSURL URLWithString:photos.face]];
        _authorNickLabel.text = photos.nick;
        _locationLabel.text = photos.location;
        
    }
    
    
    
}








/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
